package com.dynamixsoftware.printershare.snmp;

import java.math.BigInteger;
import java.util.Vector;

public class SNMPPDU
  extends SNMPSequence
{
  public SNMPPDU(byte paramByte, int paramInt1, int paramInt2, int paramInt3, SNMPSequence paramSNMPSequence)
    throws SNMPBadValueException
  {
    Vector localVector = new Vector();
    this.tag = paramByte;
    localVector.insertElementAt(new SNMPInteger(paramInt1), 0);
    localVector.insertElementAt(new SNMPInteger(paramInt2), 1);
    localVector.insertElementAt(new SNMPInteger(paramInt3), 2);
    localVector.insertElementAt(paramSNMPSequence, 3);
    setValue(localVector);
  }
  
  protected SNMPPDU(byte[] paramArrayOfByte, byte paramByte)
    throws SNMPBadValueException
  {
    this.tag = paramByte;
    extractFromBEREncoding(paramArrayOfByte);
    Vector localVector = (Vector)getValue();
    if (localVector.size() != 4) {
      throw new SNMPBadValueException("Bad PDU");
    }
    if (!(localVector.elementAt(0) instanceof SNMPInteger)) {
      throw new SNMPBadValueException("Bad PDU: bad request ID");
    }
    if (!(localVector.elementAt(1) instanceof SNMPInteger)) {
      throw new SNMPBadValueException("Bad PDU: bad error status");
    }
    if (!(localVector.elementAt(2) instanceof SNMPInteger)) {
      throw new SNMPBadValueException("Bad PDU: bad error index");
    }
    if (!(localVector.elementAt(3) instanceof SNMPSequence)) {
      throw new SNMPBadValueException("Bad PDU: bad variable binding list");
    }
    SNMPSequence localSNMPSequence1 = getVarBindList();
    for (int i = 0; i < localSNMPSequence1.size(); i++)
    {
      SNMPObject localSNMPObject = localSNMPSequence1.getSNMPObjectAt(i);
      if (!(localSNMPObject instanceof SNMPSequence)) {
        throw new SNMPBadValueException("Bad PDU: bad variable binding at index" + i);
      }
      SNMPSequence localSNMPSequence2 = (SNMPSequence)localSNMPObject;
      if ((localSNMPSequence2.size() != 2) || (!(localSNMPSequence2.getSNMPObjectAt(0) instanceof SNMPObjectIdentifier))) {
        throw new SNMPBadValueException("Bad PDU: bad variable binding at index" + i);
      }
    }
  }
  
  public int getErrorIndex()
  {
    return ((BigInteger)((SNMPInteger)((Vector)getValue()).elementAt(2)).getValue()).intValue();
  }
  
  public int getErrorStatus()
  {
    return ((BigInteger)((SNMPInteger)((Vector)getValue()).elementAt(1)).getValue()).intValue();
  }
  
  public byte getPDUType()
  {
    return this.tag;
  }
  
  public int getRequestID()
  {
    return ((BigInteger)((SNMPInteger)((Vector)getValue()).elementAt(0)).getValue()).intValue();
  }
  
  public SNMPSequence getVarBindList()
  {
    return (SNMPSequence)((Vector)getValue()).elementAt(3);
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.snmp.SNMPPDU
 * JD-Core Version:    0.7.0.1
 */